<%@include file="startUpIncludes.jsp" %>
   <%--<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> --%> 
  <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

        <title>
            Manage Users
        </title>
        <script type="text/javascript" src="../js/jquery1-8.js"></script>
<script type="text/javascript" src="../js/jquery-ui-core.js"></script>
<script type="text/javascript" src="../js/jquery-ui-widget.js"></script>
	 <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../js/modalwin.js">
    </script>
        <script type="text/javascript">
    $(document).ready (function () {
    	$('.delete').click (function () {
    		return confirm ("Are you sure you want to " + $(this).attr ("title") + "?") ;
    	}) ; 
    }) ;
</script>
<style>
div.scroll
{
width: 1000px;
  height: 1000px;
  overflow: auto;
}
</style>
    </head>
    <body class="leadsPage">
    <jsp:include page="header.jsp" >
		<jsp:param value="true" name="loggedIn"/>
	</jsp:include>
    <div class="wrap">
	<div class="fitBG">
        <div class="main">
		<%@include file="basicLeftMenu.jsp" %>
            <div class="content">
				<jsp:include page="tabs.jsp" >
					<jsp:param value="manageUsers" name="currentPage"/>
				</jsp:include>
                <div class="tab-content">
                <h3>
                Manage Users
                <form action="/sales/s/search" method="post" class="search-form">
                	<input type="text" name="query" class="TB" value="${query}"/>
                	<input type="submit" value="search" class="inf"/>
                </form>
                </h3>
				<div class="lead-view">
				<%-- <form name="leadView" action="/sales/s/view">
				<span>View lead using: </span>
				<select class="TB" name="viewId">
                <c:forEach items="${ leadViews }" var="leadView">
					<option value="${ leadView.id }">${ leadView.name }</option>
				</c:forEach>
				</select>
				<input type="hidden" value="1" name="leadTypeId"/>
				<input type="submit" value="GO" class="inf"/>
				</form>
				<a href="#">Edit Selected View</a>
				<a href="#">Create New View</a> --%>
				</div>
                <div class="content-block">
                    <h4>Recent Users</h4>
             
                    <div class="scroll-table">
						<c:choose>
	                <c:when test="${empty users}">
	                <div class="noData">No data to preview...</div>
	                </c:when>	
	                <c:otherwise>
	                  <form:form  action="manageUsers" method="post" >
	                  
	                <table class="recent-leads" style="float: none !important;">
                        <thead>
                            <tr>
                            	<th  class="p15">Users</th>
                                <th class="p40">Owner</th>
                                <th class="p15">Lead Generator</th>
                                <th class="p15">Sales Manager</th>
                                <th class="p15">Sales Man</th>
                                <th class="p15">Bussiness Developer</th>
                                <th class="p15">Lead Add</th>
                                <th class="p15">Lead Edit</th>
                                <th class="p15">Lead Delete</th>
                                <th class="p15">Lead View</th>
                                <th class="p15">Lead Convert</th>
                                <th class="p15">Lead Import</th>
                                <th class="p15">Lead Fellow</th>
                                <th class="p15">Call Add</th>
                                <th class="p15">Call Edit</th>
                                <th class="p15">Call View</th>
                                <th class="p15">Appointment Add</th>
                                <th class="p15">Appointment Edit</th>
                                <th class="p15">Appointment View</th>
                                <th class="p15">Account Add</th>
                                <th class="p15">Account Edit</th>
                                <th class="p15">Account Delete</th>
                                <th class="p15">Account View</th>
                                <th class="p15">Account Convert</th>
                                <th class="p15">Account Fellow</th>
                                <th class="p15">Contact Add</th>
                                <th class="p15">Contact Edit</th>
                                <th class="p15">Contact Delete</th>
                                <th class="p15">Contact View</th>
                                <th class="p15">Contact Fellow</th>
                                <th class="p15">Add Stock Category</th>
                                <th class="p15">View Stock Category</th>
                                <th class="p15">Edit Stock Category</th>
                                <th class="p15">Delete Stock Category</th>                      
                                <th class="p15">Add Stock Sub Category</th>
                                <th class="p15">View Stock Sub Category</th>
                                <th class="p15">Edit Stock Sub Category</th>
                                <th class="p15">Delete Stock Sub Category</th>
                                <th class="p15">Add Stock Product Category</th>
                                <th class="p15">View Stock Product Category</th>
                                <th class="p15">Edit Stock Product Category</th>
                                <th class="p15">Delete Stock Product Category</th>
                                <th class="p15">Add Stock SKU Category</th>
                                <th class="p15">View Stock SKU Category</th>
                                <th class="p15">Edit Stock SKU Category</th>
                                <th class="p15">Delete Stock SKU Category</th>	
                                <th class="p15">Add New Invoice</th>
                                <th class="p15">View Invoice</th>
                                <th class="p15">Export Invoice</th>	
                                <th class="p15">Add New Tax Invoice</th>
                                <th class="p15">View Tax Invoice</th>
                                <th class="p15">Edit Tax Invoice</th>
                                <th class="p15">Delete Invoice</th>
                                <th class="p15">View all Taxes</th>
                            </tr>
                        </thead>
                        <tbody>
                         <c:forEach items="${users }" var="user" >
                            <tr>
                        <td>
                        ${ user.username}
                        </td>
                         <td>
                         <c:set var="role" value="owner" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}owner" />
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}owner"/>
                         </c:if>
                      
                        </td> 
                       
                        <td>
                         <c:set var="role" value="leadgenerator" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadgenerator"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadgenerator"/>
                         </c:if>
                      
                        </td>
                        
                        
                        <td>
                         <c:set var="role" value="salesmanager" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}salesmanager"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox"  name="${user.id}salesmanager"/>
                         </c:if>
                       
                        </td>
                        
                        
                        <td>
                        <c:set var="role" value="salesman" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}salesman"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}salesman"/>
                         </c:if>
                        </td>
                        
                        
                        <td>
                        <c:set var="role" value="bussinessdeveloper" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}bussinessdeveloper"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}bussinessdeveloper"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadAdd"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadEdit"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadDelete"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadView"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadConvert" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadConvert"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadConvert"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadImport" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadImport"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadImport"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="leadFellow" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}leadFellow"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}leadFellow"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="callAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}callAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}callAdd"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="callEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}callEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}callEdit"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="callView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}callView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}callView"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="appointmentAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}appointmentAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}appointmentAdd"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="appointmentEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}appointmentEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}appointmentEdit"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="appointmentView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}appointmentView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}appointmentView"/>
                         </c:if>
                       
                        </td>
                        
                        <td>
                        <c:set var="role" value="accountAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountAdd"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="accountEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountEdit"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="accountDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountDelete"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="accountView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountView"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="accountConvert" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountConvert"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountConvert"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="accountFellow" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}accountFellow"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}accountFellow"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="contactAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}contactAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}contactAdd"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="contactEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}contactEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}contactEdit"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="contactDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}contactDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}contactDelete"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="contactView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}contactView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}contactView"/>
                         </c:if>
                       
                        </td>
                        <td>
                        <c:set var="role" value="contactFellow" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}contactFellow"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}contactFellow"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockCategoryAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockCategoryAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockCategoryAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockCategoryView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockCategoryView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockCategoryView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockCategoryEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockCategoryEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockCategoryEdit"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockCategoryDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockCategoryDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockCategoryDelete"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="subCategoryAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}subCategoryAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}subCategoryAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="subCategoryView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}subCategoryView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}subCategoryView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="subCategoryEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}subCategoryEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}subCategoryEdit"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="subCategoryDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}subCategoryDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}subCategoryDelete"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockProductAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockProductAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockProductAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockProductView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockProductView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockProductView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockProductEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockProductEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockProductEdit"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockProductDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockProductDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockProductDelete"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockSKUAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockSKUAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockSKUAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockSKUView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockSKUView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockSKUView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockSKUEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockSKUEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockSKUEdit"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="stockSKUDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}stockSKUDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}stockSKUDelete"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceExport" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceExport"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceExport"/>
                         </c:if>                  
                        </td>  
                         <td>
                        <c:set var="role" value="invoiceView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceTaxAdd" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceTaxAdd"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceTaxAdd"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceTaxView" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceTaxView"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceTaxView"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceTaxEdit" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceTaxEdit"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceTaxEdit"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="invoiceTaxDelete" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}invoiceTaxDelete"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}invoiceTaxDelete"/>
                         </c:if>                  
                        </td>
                        <td>
                        <c:set var="role" value="viewAllTaxes" />
                         <c:set var="contains" value="false"/>
                         <c:forEach var = "userrole" items="${user.roles}">
                         <c:if test="${ userrole.name eq role}">
                         <c:set var="contains" value="true"/>
                         </c:if>
                         </c:forEach>
                         <c:if test="${contains eq true }">
                          <input type="checkbox" checked="checked" name="${user.id}viewAllTaxes"/>
                         </c:if>
                         <c:if test="${contains eq false }">
                            <input type="checkbox" name="${user.id}viewAllTaxes"/>
                         </c:if>                  
                        </td>                   
                           </tr>
                      	</c:forEach>			
                        </tbody>
                        </table>
                        
                        <input type="submit" value="Update">
                        </form:form>
	                </c:otherwise>
	                </c:choose>
	                </div>
	             
                </div>
            </div>
        </div>
        </div>
        
    <%@include file="footer.jspf" %>
    </div>
    </div>
    

    </body>
</html>